package com.daomx.advertising.controller;

import com.daomx.common.config.MockConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by xiaodao
 * date: 2019/8/16
 */
@RequestMapping("/mock")
@RestController
//@CrossOrigin
public class MockController {

	@Autowired
	private MockConfig mockConfig;

	/**
	 * 菜单
	 *
	 * @return
	 */
	@RequestMapping("/index/menu")
	public String indexMenu() {
		return this.mockConfig.getIndexMenu();
	}

	/**
	 * 首页资讯 * @return
	 */
	@RequestMapping("index/info")
	public String indexInfo() {
		return this.mockConfig.getIndexInfo();
	}

	/**
	 * 首页问答 * @return
	 */
	@RequestMapping("index/faq")
	public String indexFaq() {
		return this.mockConfig.getIndexFaq();
	}

	/**
	 * 首页房源信息 * @return
	 */
	@RequestMapping("index/house")
	public String indexHouse() {
		return this.mockConfig.getIndexHouse();
	}


	/**
	 * 查询资讯
	 *
	 * @param type * @return
	 */
	@RequestMapping("infos/list")
	public String infosList(@RequestParam("type") Integer type) {
		switch (type) {
			case 1:
				return this.mockConfig.getInfosList1();
			case 2:
				return this.mockConfig.getInfosList2();
			case 3:
				return this.mockConfig.getInfosList3();
		}
		return this.mockConfig.getInfosList1();

	}

	/**
	 * 我的中心 * @return
	 */
	@RequestMapping("my/info")
	public String myInfo() {
		return this.mockConfig.getMy();
	}
}
